/* eslint-disable no-console */

// #region snippet
// Spring Boot 应用示例
export const springBootApp = `
@SpringBootApplication
public class JavaEEApplication {
    public static void main(String[] args) {
        SpringApplication.run(JavaEEApplication.class, args);
    }
}
`;
// #endregion snippet

// REST控制器示例
export const restController = `
@RestController
@RequestMapping("/api/users")
public class UserController {
    private final UserService userService;
    
    public UserController(UserService userService) {
        this.userService = userService;
    }
    
    @GetMapping("/{id}")
    public ResponseEntity<User> getUserById(@PathVariable Long id) {
        return ResponseEntity.ok(userService.findById(id));
    }
}
`;

// MyBatis Mapper示例
export const mybatisMapper = `
@Mapper
public interface UserMapper {
    @Select("SELECT * FROM users WHERE id = #{id}")
    User findById(Long id);
    
    @Insert("INSERT INTO users(username, email) VALUES(#{username}, #{email})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(User user);
}
`;

// 打印Java版本信息
export function printJavaInfo() {
    console.log('Java版本: Java 17 LTS');
    console.log('Spring Boot版本: 3.2.0');
    console.log('Spring Framework版本: 6.1.0');
}

export function emptyArray<T>(length: number) {
  return Array.from<T>({ length })
}

export function sayHello() {
  console.log('Hello from snippets/external.ts')
}
